package algo_annotations.ihm.couche;

import algo_annotations.data.Data_a;
import algo_annotations.data.annotations.Anno;
import commons.data.I_Data.DataType;
import commons.drawing.I_Drawable;
import commons.drawing.couche.CoucheBasic;
import commons.utils.primitive_geom.Rect_d;
import java.util.ArrayList;

// Couche des liens entre une annotation et son site
public class CoucheAnno_LIEN extends CoucheBasic {

	public CoucheAnno_LIEN(Data_a data) {
		super("Annotation lien", null, data);
	}

	@Override
	public ArrayList<I_Drawable> getDrawables(Rect_d rectVisu) {
		ArrayList<Anno> vAnno = data.getData(DataType.ANNO_A, rectVisu);
		
		if (vAnno ==null)
			return new ArrayList<I_Drawable>(0);

		//TODO creer des drawables lien de facon efficace !
		ArrayList<I_Drawable> vAnnoLien = new ArrayList<I_Drawable>(vAnno.size());
		for (Anno anno : vAnno) {
			if (!anno.site.hasAnno()) continue; // site sans anno
			vAnnoLien.add(anno.lienAnnoSite);
		}

		return vAnnoLien;
	}
}
